﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spark.FileSystem;
using System.IO;

namespace NBusiness.Templates.Engines.Spark
{
    class NBusinessViewFile : IViewFile, IDisposable
    {
        MemoryStream _stream;
        long _lastModified;

        public NBusinessViewFile(string template)
        {
            _stream = new MemoryStream(Encoding.UTF8.GetBytes(template));
            _lastModified = DateTime.Now.ToFileTime();
        }

        #region IViewFile Members

        public long LastModified
        {
            get { return _lastModified; }
        }

        public Stream OpenViewStream()
        {
            return _stream;
        }

        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            _stream.Dispose();
        }

        #endregion
    }
}
